from .relys import BitSet
from .relys import Chip

class AND(Chip):
    def __init__(self, width):
        super().__init__(width+1, [0,width],[width])
        self.enmask = pow(2, width)-1

@AND.keyframe(-1)
def _frame(chip):
    if chip.pinIN() == self.enmask : chip.pinOUT(1)
    else : chip.pinOUT(0)